// 封装操作localStorage本地储存的方法 模块化的文件

//nodejs 基础

var storage = {

    set(key, value) {
        localStorage.setItem(key, JSON.stringify(value));
    },
    get(key) {
        let v = localStorage.getItem(key);
        if (v && typeof (v) !== "undefined" && v !== "undefined") {
            return JSON.parse(v);
        }
    },
    remove(key) {
        localStorage.removeItem(key);
    },
    clearAll: function () {
        localStorage.clear();
    }
}

export default storage;
